<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
</head>
<body>
<form action="https://www.baidu.com">
    用户名:<input type="text" id="name" onkeyup="keyup()"><span id="span" ></span><br><br>
    密&nbsp;&nbsp码:<input type="text"><br><br>
    <input type="submit" value="注册"  >
</form>
</body>
</html>
<script type="text/javascript">
    function keyup() {
        var name = $("#name").val();
        $.ajax({
            url:"../json/verify.json",
            type:"get",
            data:"",
            dataType:"json",
            success:function (data) {
                if (name != ""){
                    $.each(data,function (a,b) {
                        if(name == b.name){
                           $("#span").text("用户已注册")
                            // alert("用户已注册")
                        }
                    })
                }
            },
            error:function () {
                alert("请求错误！")
            }
        })
    }
</script>